package com.runrunfast.fxj.enums;

import lombok.Getter;

/**
 * @author: 陈胤训
 * @create: 2018-08-08 16:28
 **/
@Getter
public enum ResourcesEnum {

    NORMAL(1, "正常"),
    REVIEW(0,"审核"),
    DISABLE(-1, "禁用"),
    RESOURCES_NULL(10, "权限不存在");

    private Integer code;
    private String desc;

    ResourcesEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static ResourcesEnum get(Integer code) {
        if (null == code) {
            return NORMAL;
        }
        ResourcesEnum[] enums = ResourcesEnum.values();
        for (ResourcesEnum anEnum : enums) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        return NORMAL;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
